Skip to content

Bake the workspace skeleton's bundle into the generator image - #45

Merged
pstrzalk merged 1 commit into
mainfrom
bake-skeleton-bundle
Sep 3, 2026
Merged

Bake the workspace skeleton's bundle into the generator image#45
pstrzalk merged 1 commit into
mainfrom
bake-skeleton-bundle

Conversation

@pstrzalk

@pstrzalk pstrzalk commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Why

Every project workspace is a copy of lib/preview/skeleton (its Gemfile.lock and frozen .bundle/config included), and the agent sandbox runs the generator image. The generator's lock had moved past the skeleton's (rails 8.1.3.1 vs 8.1.3, puma 8.0.2 vs 8.0.1, sqlite3 2.9.6 vs 2.9.3), so inside every sandbox bundle check failed and Bundler re-downloaded all 116 gems into a container that is discarded a minute later.

Measured on production project 36 (2026-09-03, logs in tmp/hifumi_project_36*.log locally):

  • creation, 6 revisions: ~9 of 32 minutes and 4 fix-agent calls were Bundler churn; verify never ran the tests before remediation on revisions 3–6
  • follow-up modification, 1 revision: 97s of 173s and $0.07 of $0.41

What

  • Dockerfile build stage: copy the skeleton's Gemfile + Gemfile.lock, bundle install them into the same BUNDLE_PATH, then bundle check so a future drift fails the image build instead of billing every revision. Cache cleanup moved after both installs.
  • CHANGELOG.md 1.5.1 Fixed entry; the "bundle vendoring" residual removed from CLAUDE.md and docs/09-ideas/05-followups.md.

Verified

docker build --target build locally (arm64): both bundles present, bundle check satisfied for the generator, for the skeleton, and for the skeleton as uid 1000 (the sandbox user). Skeleton install adds ~8s to the build.

After merge

kamal deploy rebuilds the image. Expect a build step to drop by ~80–95s and one fix-agent call, and W2.4 verify to run the generated app's tests on the first pass again.

🤖 Generated with Claude Code

https://claude.ai/code/session_0117StvHb26xv3MUepWHhcWy

Every workspace starts as a copy of lib/preview/skeleton, lockfile and frozen
.bundle/config included, and the agent sandbox is the generator image itself.
The generator's own lock had moved past the skeleton's (rails 8.1.3.1 vs 8.1.3,
puma 8.0.2 vs 8.0.1, sqlite3 2.9.6 vs 2.9.3), so `bundle check` inside every
sandbox failed and Bundler re-downloaded all 116 gems into the throwaway
container, revision after revision. On project 36 (2026-09-03) that was ~9 of
32 minutes and an extra fix-agent call per step, with verify never reaching the
tests before remediation; the follow-up modification paid 97s of its 173s.

The build stage now installs the skeleton's bundle next to the generator's and
runs `bundle check` against it, so a future drift fails the image build instead
of billing every revision. Verified locally: both bundles resolve, and the
skeleton's `bundle check` passes as root and as uid 1000.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117StvHb26xv3MUepWHhcWy
@pstrzalk
pstrzalk merged commit e99af11 into main Sep 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants